#include <xpam/system/mutex.h>
#include <windows.h>
namespace xpam
{
    namespace system
    {
        mutex::mutex(bool lock)
        {
            _mutex = CreateMutex(0, lock, 0);
        }

        mutex::~mutex(void)
        {
            CloseHandle(_mutex);
        }

        void mutex::wait()
        {
            WaitForSingleObject(_mutex, INFINITE);
        }

        void mutex::release()
        {
            ReleaseMutex(_mutex);
        }
    }
}